<?php
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
use App\Api\Util\JRequest;
use Dingo\Api\Exception\StoreResourceFailedException;
use Illuminate\Support\Facades\DB;
use \Illuminate\Support\Facades\Log;


DB::listen(function($query){
	if(env('ENABLE_SQL_LOG') == true) {
		$sql = $query -> sql;
		$bindings = $query -> bindings;
		Log::info($sql." | bindings:".json_encode($bindings)."");
	}
});

$api = app('Dingo\Api\Routing\Router');
$api->version('v1', function ($api) {
    $api->group(['prefix' => 'v1', 'namespace' => 'App\Api\Controllers\V1', 'middleware' => ['apicors','request.log']], function ($api) {
        //                讲师详情
        $api->get('author-html', 'AuthorController@authorHtml');
        //获取app当前版本
        $api->get('app-vertion', 'AppController@vertion');
        //版本状态
        $api->get('app-audit', 'AppController@audit');
    });
    $api->group(['prefix' => 'v1', 'namespace' => 'App\Api\Controllers\V1', 'middleware' => ['jwt.api.auth','request.log']], function ($api) {

//		    跨域中间件验证
        $api->group(['middleware' => ['cors']], function ($api) {

            /**
             * @name 启动页设置
             */
            $api->any('start-lists','AppStartSetController@getLists');

        });

        /**
         * 员工风采删除
         */
        $api->post('staff-style-delete', 'StaffStyleController@staffStyleDelete');

        /**
         * 公共方法
         */
        //上传图片方法
        $api->post('/upload-images', 'SystemController@uploadImages');
        /**
         * @name 上传视频方法
         */
        $api->post('upload-video', 'SystemController@uploadVideo');

        /**
         * @name 更新企业新闻数据方式
         */
        $api->post('update-miens', 'SystemController@updateMiens');
        /**
         * 限制
         * */
        $api->get('/restriction', 'ApplyController@restriction');


        /*
         * 腾讯云通讯
         *im
         * */
        //获取usersig
        $api->get('/usersig', 'TencentImController@getUserSig');
        //导入新账号
        $api->post('/addImUser', 'TencentImController@addImUser');
        //批量 导入新账号
        $api->post('/import-account-multi', 'TencentImController@importAccountMulti');
        //导入单个账号
        $api->post('/import-account', 'TencentImController@importAccount');


        /*
         * qpp 查看开机图
         * */
        //$api->get('/showCompanyLogo', 'CustomController@appShowCompanyLogo');

        /*
        /*
         * qpp 查看开机图
         * */
        //$api->get('/showCompanyLogo', 'CustomController@appShowCompanyLogo');

        /*
        /*
         * 焦点位
         * */
        $api->get('/home-gather', 'HomeController@gather');//V-User iHammer 方法废弃

        /**
         * Api Doc
         */
        $api->get('/', 'ApiDoc@index');

        /**
         * Register & Login
         */
        $api->get('verifyCode', 'AuthController@VerifyCode');//V-User iHammer 发送验证 v2.0
        $api->get('sendVerifyCode', 'AuthController@sendVerifyCode');//V-User iHammer  只是做发送验证码处理 v2.0
        $api->get('getVerifyCode', 'AuthController@getVerifyCode');//V-User iHammer 获取最后一次的验证码 v2.0
        $api->post('login', 'AuthController@authenticateApi');//V-User iHammer 登录
        $api->post('register', 'AuthController@register');//V-User iHammer 注册

        /**
         * 意见反馈
         * 参数 : content(内容)
         * */
        $api->post('feedback-add', 'FeedbackController@add');




        /**
         * Token Auth
         */
        $api->group(['middleware' => ['jwt.auth']], function ($api) {


        });

    });
});

